/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.oracleandsxnd.erp.seting.web;

import com.oracleandsxnd.erp.common.persistence.Page;
import com.oracleandsxnd.erp.common.persistence.TableSplitResult;
import com.oracleandsxnd.erp.common.web.AjaxResult;
import com.oracleandsxnd.erp.common.web.BaseController;
import com.oracleandsxnd.erp.seting.entity.Logistics;
import com.oracleandsxnd.erp.seting.service.LogisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 物流公司Controller
 * @author 物流公司
 * @version 2019-12-17
 */
@Controller
@RequestMapping(value = "seting_logistics")
public class LogisticsController extends BaseController {

	@Autowired
	private LogisticsService logisticsService;

	@RequestMapping(value = {""})
	public String list(Logistics logistics, HttpServletRequest request, HttpServletResponse response, Model model) {
		return "erp/seting/logisticsList";
	}

	@RequestMapping(value = {"listData"})
	@ResponseBody
	public Object listData(Logistics logistics , HttpServletRequest request, HttpServletResponse response){
		Page<Logistics> page = logisticsService.findPage(new Page<Logistics>(request, response), logistics);
		TableSplitResult<Logistics> result=new TableSplitResult<Logistics>(page.getPageNo(), page.getCount(), page.getList());
		return  result;
	}
	@RequestMapping(value = "save")
	@ResponseBody
	public AjaxResult save(Logistics logistics) {

		logisticsService.save(logistics);
		return success();
	}

	@RequestMapping(value = "delete")
	@ResponseBody
	public AjaxResult  delete(Logistics logistics, RedirectAttributes redirectAttributes) {
		logisticsService.delete(logistics);
		return success();
	}


}